<!DOCTYPE html PUBLIC 
    "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
<html 
	xmlns="http://www.w3.org/1999/xhtml" 
	xmlns:ui="http://java.sun.com/jsf/facelets" 
	xmlns:h="http://java.sun.com/jsf/html" 
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:t="http://myfaces.apache.org/tomahawk"> 

	<ui:composition template="t_loggedin.xhtml">

	<ui:define name="menu">
		<h:form>
			<table class="leftmenu">
				<tbody>
					<!-- Graphical image -->
					<tr class="leftmenuheader">
						<th colspan="2"></th>
					</tr>
					<tr class="leftmenu">
                        <td colspan="2" class="image">
							<h:graphicImage value="images/esb-active.png" rendered="#{esbBean.started}"/>
							<h:graphicImage value="images/esb-inactive.png" rendered="#{!esbBean.started}"/>
						</td>
					</tr>				
					
					<!-- Status -->					
					<tr class="leftmenuheader">
						<th colspan="2"><h:outputText value="#{msgs['menu.heading.status']}" /></th>
					</tr>
					<tr class="leftmenu">
						<th><h:outputText value="#{msgs['esb.menu.status']}" /></th>
						<td><h:outputText value="#{esbBean.status}" /></td>
					</tr>

					<!-- Deployed message flows -->
					<tr class="leftmenuheader">
						<th colspan="2"><h:outputText value="#{msgs['menu.heading.flows']}" /></th>
					</tr>		
					<tr class="leftmenu">
						<th><h:outputText value="#{msgs['esb.menu.flows']}" /></th>
						<td><h:outputText value="#{esbBean.flows}" /></td>
					</tr>

					<!-- Actions -->
					<tr class="leftmenuheader">
						<th colspan="2">
							<h:outputText value="#{msgs['menu.heading.actions']}" />
						</th>
					</tr>
					<!-- 
					The URL is specified in the default Mule configuration file.
					Thus, it will only work if Mule is started using this configuration.
					In case of different configuration, the menu item is not rendered.
					 -->
					<tr class="leftmenu">
						<td colspan="2">
							<h:panelGroup rendered="#{(esbBean.startupType=='default')}">
							<a href="http://localhost:8888/mulestats" onclick="window.open(this.href);return false;">
								<h:outputText value="#{msgs['esb.menu.action.statistics']}"/>
							</a>
							</h:panelGroup>							
						</td>
					</tr>
					<!-- 
					The URL is specified in the default Mule configuration file.
					Thus, it will only work if Mule is started using this configuration.
					In case of different configuration, the menu item is not rendered.
					 -->					
					<tr class="leftmenu">
						<td colspan="2">
							<h:panelGroup rendered="#{(esbBean.startupType=='default')}">
							<a href="http://localhost:9999" onclick="window.open(this.href);return false;">
								<h:outputText value="#{msgs['esb.menu.action.jmxconsole']}"/>
							</a>
							</h:panelGroup>		
						</td>
					</tr>					
					<tr class="leftmenu">
						<td colspan="2">					
							<h:panelGroup rendered="#{!esbBean.newFlowView}">
								<h:commandLink value="#{msgs['esb.menu.action.deploy']}" action="${esbBean.toggleNewFlowView}"/> 
							</h:panelGroup>
							<h:panelGroup rendered="#{esbBean.newFlowView}">
								<h:commandLink value="#{msgs['esb.menu.action.deploy.hide']}" action="${esbBean.toggleNewFlowView}"/> 
							</h:panelGroup>							
						</td>
					</tr>
					
					<!-- Control -->
					<tr class="leftmenuheader">
						<th colspan="2">
							<h:outputText value="#{msgs['menu.heading.control']}" />
						</th>
					</tr>
					<tr class="leftmenu">
						<td colspan="2" width="150px">
						<h:outputText value="#{msgs['esb.menu.action.info']}" />
						</td>
					</tr>
					<tr class="leftmenu">
						<td align="center">
							<h:commandButton 
									id="esbStartButton"
									disabled="#{esbBean.started}"
									action="#{esbBean.getStatus}" 
									actionListener="#{esbStopStartActionHandler.startESB}"
									value="#{msgs['esb.menu.action.start']}">
							</h:commandButton>
						</td>
						<td align="center">
							<h:commandButton 
									id="esbStopbutton"
									disabled="#{!esbBean.started}"
									action="#{esbBean.getStatus}" 
									actionListener="#{esbStopStartActionHandler.stopESB}"
									value="#{msgs['esb.menu.action.stop']}">
							</h:commandButton>
						</td>
					</tr>
				</tbody>
			</table>
		</h:form>
	</ui:define>


	<ui:define name="body">
		<ui:decorate template="faces/esb_stats.xhtml" />
		<h:panelGroup rendered="#{esbBean.newFlowView}">
			<ui:decorate template="faces/esb_uploadconfig.xhtml" />
		</h:panelGroup>		
	</ui:define>

</ui:composition>

</html>